package com.lizhijun.service.impl;

import com.lizhijun.mapper.UserMapper;
import com.lizhijun.pojo.User;
import com.lizhijun.service.UserService;
import com.lizhijun.utils.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserServiceImpl implements UserService {

    private SqlSessionFactory sqlSessionFactory = MybatisUtil.getSqlSessionFactory();

    @Override
    public User findUser(User user) {
        SqlSession sqlSession = sqlSessionFactory.openSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        User user1 = userMapper.findUser(user);
        sqlSession.close();
        return user1;
    }
}
